<template>
	<view class="page">
		<image v-if="flag" :src="records.picEditor" mode="widthFix" style="width:100%;"></image>
		<!-- <image v-if="flag" src="/static/logo.png" mode="widthFix" style="width:100%;"></image> -->
		<video v-else id="myVideo" :src="records.picEditor" style="width:100%;height:100vh;"></video>
	</view>
</template>

<script>
	const api = require('../../config/api');
	const util = require('../../utils/util');
	export default {
		data() {
			return {
				id: 0,
				flag: true,
				records:{},
				goods: [],
			}
		},
		onLoad(o) {
			console.log(o);
			this.id = o.id
			this.getpiclis();
		},
		onShow() {
		},
		methods: {
			async getpiclis() {
				const res = await util.request(
					api.piclistUrl, {},
					'POST'
				);
				console.log(res);
				if (res.code !== 0) {
					uni.showToast({
						title: res.msg,
						icon: "none"
					})

				} else {
					this.goods = res.data
					// this.flag = res.data[this.id].picEditor.endsWith('png');
					this.records = res.data[this.id]
					this.flag = res.data[this.id].picEditor.substr(res.data[this.id].picEditor.length - 3, 3) ==
						'png' ? true : false
				}
			},
		}
	}
</script>

<style>
	.page {
		display: flex;
		height: 100vh;
	}
</style>